package com.csw.monkmanager.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Date;

@NoArgsConstructor
@Data
/**
 * @author 1
 */
@Accessors(chain = true)
@AllArgsConstructor
@Document(indexName = "cmfz", indexStoreType = "article")
public class Article implements Serializable {
	@Id
	@org.springframework.data.annotation.Id
	private String id;// `id` varchar(255) NOT NULL,
	@Field(type = FieldType.Text, analyzer = "ik_max_word")
	private String title;// `title` varchar(255) DEFAULT NULL,
	@org.springframework.data.annotation.Transient
	private String url;// `img` varchar(255) DEFAULT NULL,
	@Field(type = FieldType.Text, analyzer = "ik_max_word")
	private String content;// `content` varchar(255) DEFAULT NULL,

	@DateTimeFormat(pattern = "YYYY-MM-dd")
	@JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date createDate;// `create_date` date DEFAULT NULL,
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
//    @Column(name = "publish_date")
//    //@JSONField(format = "yyyy-MM-dd")
//    @Field(type = FieldType.Date)
	private Date publishDate;// `publish_date` date DEFAULT NULL,
	private String status;// `status` varchar(255) DEFAULT NULL,
	@Column(name = "guru_id")
	private String guruId;// `guru_id` varchar(255) DEFAULT NULL,
	/*分词必加*/
	/*@Field(type = FieldType.Date,format = DateFormat.basic_date_time)
	@JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss", timezone = "GMT+8")
	private Date pubdate;*/

}
